package com.icss.day01;

import java.util.Arrays;

public class Test3 {
    public static void main(String[] args) {

        int[] a1 = {3,5,1,1,2,4,32,545,6784,65,234,213,5167,33};
        Arrays.sort(a1);

        for (int i = 0; i < a1.length; i++) {
            System.out.println(a1[i]);
        }

        Arrays.sort(a1);

       int[] a2 = Arrays.copyOf(a1, 5);
        System.out.println("--------------------------------");
        for (int item: a2) {
            System.out.println(item);
        }

        // 11234  3的元素不要了  1124
        int[] newa2 = new int[a2.length - 1];
        int index = 3;

        // 五个参数
        System.arraycopy(a2, 0, newa2, 0, index);
        System.arraycopy(a2, index + 1, newa2, index, newa2.length - index);

        System.out.println("--------------------------------");
        for (int item: newa2) {
            System.out.println(item);
        }


    }
}
